const express = require('express');
const router = express.Router();
const buyerController = require('../controllers/buyerController');
const authMiddleware = require('../middleware/authMiddleware');

/**
 * @route GET /api/buyer/orders
 * @desc 获取买家订单列表
 * @access Private
 */
router.get('/orders', authMiddleware, buyerController.getOrders);

/**
 * @route PUT /api/buyer/orders/:order_id/pay
 * @desc 支付订单
 * @access Private
 */
router.put('/orders/:order_id/pay', authMiddleware, buyerController.payOrder);

/**
 * @route PUT /api/buyer/orders/:order_id/confirm
 * @desc 确认收货
 * @access Private
 */
router.put('/orders/:order_id/confirm', authMiddleware, buyerController.updateOrderStatus);

/**
 * @route PUT /api/buyer/orders/:order_id/cancel
 * @desc 取消订单
 * @access Private
 */
router.put('/orders/:order_id/cancel', authMiddleware, buyerController.cancelOrder);

module.exports = router;